//
//  HLEDateConflictTool.h
//  HomeLinking
//
//  Created by hle1879 on 2021/8/2.
//  Copyright © 2021 HLE. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef enum : NSUInteger {
    Date_Type_Default = 0,
    Date_Type_Repeat
} ConflictDateType;

typedef enum : NSUInteger {
    Sunday = 1,
    Monday,
    Tuesday,
    Wednesday,
    Thursday,
    Friday,
    Saturday
} RepeatType;

@interface HLEDateConflictItem : NSObject

@property(nonatomic,strong)NSDate *startDate;//开始日期,当type = Date_Type_Default 有效
@property(nonatomic,strong)NSDate *endDate;//结束日期,当type = Date_Type_Default 有效
@property(nonatomic,strong)NSDate *startTime;//开始时间
@property(nonatomic,strong)NSDate *endTime;//结束时间
@property(nonatomic,assign)ConflictDateType type;//类型
@property(nonatomic,copy)NSArray* repeatTypes;//重复类型数组，当type = Date_Type_Repeat 有效

//初始化普通时间
-(instancetype)initWithStartDate:(NSDate *)startDate endDate:(NSDate*)endDate startTime:(NSDate*)startTime endTime:(NSDate*)endTime;

//初始化重复时间
-(instancetype)initWithStartTime:(NSDate*)startTime endTime:(NSDate*)endTime repeatTypes:(NSArray*)repeatTypes;

//基本初始化
-(instancetype)initWithStartDate:(NSDate  * _Nullable )startDate endDate:(NSDate * _Nullable)endDate startTime:(NSDate*)startTime endTime:(NSDate*)endTime type:(ConflictDateType)type repeatTypes:(NSArray * _Nullable)repeatTypes;

@end

@interface HLEDateConflictTool : NSObject

//判断时间是否有冲突
+(BOOL)timeIsConflict:(NSArray<HLEDateConflictItem*>*)dateArray forItem:(HLEDateConflictItem*)item;
@end

NS_ASSUME_NONNULL_END
